package com.tanglongan.designPattern.dp08_composite.demo01;

/**
 * 课程
 */
public class Course extends CourseCompoent {
    private String name;
    private double price;

    public Course(String name, double price) {
        this.name = name;
        this.price = price;
    }

    @Override
    public String getName(CourseCompoent compoent) {
        return this.name;
    }

    @Override
    public Double getPrice(CourseCompoent compoent) {
        return this.price;
    }

    @Override
    public void print() {
        System.out.println(name + "（￥" + price + "元）");
    }

}
